import request from '@/utils/request'

// 查询待开票报关单列表
export function listPendingInvoices() {
  return request({
    url: '/fiscale/tax/pendingInvoices',
    method: 'get'
  })
}

// 根据报关单ID列表获取待开票详情
export function getPendingInvoiceDetails(data) {
  return request({
    url: '/fiscale/tax/pendingInvoices/details',
    method: 'post',
    data: data
  })
}

// 预览发票
export function previewInvoice(data) {
  return request({
    url: '/fiscale/tax/previewInvoice',
    method: 'post',
    data: data
  })
}

// 开具发票
export function issueInvoice(data) {
  return request({
    url: '/fiscale/tax/issueInvoice',
    method: 'post',
    data: data
  })
}

// 下载发票
export function downloadInvoice(invoiceId) {
  return request({
    url: '/fiscale/tax/downloadInvoice/' + invoiceId,
    method: 'get'
  })
}

// 查询已开发票列表
export function listIssuedInvoices(query) {
  return request({
    url: '/fiscale/tax/issuedInvoices',
    method: 'get',
    params: query
  })
}

// 获取已开发票详细信息
export function getIssuedInvoice(invoiceId) {
  return request({
    url: '/fiscale/tax/issuedInvoices/' + invoiceId,
    method: 'get'
  })
}

// 撤销发票
export function revokeInvoice(invoiceId) {
  return request({
    url: '/fiscale/tax/revokeInvoice/' + invoiceId,
    method: 'put'
  })
}

// 重新开具发票
export function reissueInvoice(invoiceId) {
  return request({
    url: '/fiscale/tax/reissueInvoice/' + invoiceId,
    method: 'put'
  })
}